﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter4.Section4
{
    public class Example14
    {
        public Example14()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Function.ToLastType<double[], double> f
                = new V.Function.ToLastType<double[], double>(ff);
            double[] x = { 1.0, 2.0, 3.0 };
            V.Laplacian del2f = new V.Laplacian(f, x);
            del2f.Compute();
            result += del2f.Result.ToString() + "\r\n";
            x[0] = 2.0;
            x[1] = 4.0;
            x[2] = 5.0;
            del2f.Compute();
            result += del2f.Result.ToString() + "\r\n";
        }
        private double ff(double[] x)
        {
            return  1.0 / Math.Sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
        }
    }
}

/*
4.52774592124561E-10
2.8852050956707E-11
*/